// ==UserScript== // @name TikTok 小助手 // @namespace http://tampermonkey.net/ // @version 5.36 // @description 获取 TikTok 数据并显示精简用户界面! // @connect * // @author belugua // @match *://*/* // @grant GM_registerMenuCommand // @grant GM_setValue // @grant GM_getValue // @grant GM_getResourceText // @grant GM_addStyle // @grant GM_xmlhttpRequest // @grant GM_setClipboard // @connect tiktok.com // @icon https://iili.io/dy5xjOg.jpg // @require https://code.jquery.com/jquery-3.6.0.min.js // @require https://cdnjs.cloudflare.com/ajax/libs/toastify-js/1.12.0/toastify.min.js // @resource TOASTIFY_CSS https://cdn.jsdelivr.net/npm/toastify-js/src/toastify.min.css // ==/UserScript== (function() { 'use strict'; console.log('Script loaded successfully'); // 加载 Toastify.js 的 CSS GM_addStyle(GM_getResourceText('TOASTIFY_CSS')); // 默认设置:页面加载时是否自动显示数据面板 let autoShowDataPanel = GM_getValue('autoShowDataPanel', false); console.log('Initial autoShowDataPanel:', autoShowDataPanel); // 注册菜单命令,切换是否自动显示数据面板 GM_registerMenuCommand('切换自动弹出数据面板', () => { autoShowDataPanel = !autoShowDataPanel; GM_setValue('autoShowDataPanel', autoShowDataPanel); alert(`自动弹出数据面板已${autoShowDataPanel ? '启用' : '禁用'}`); console.log('Toggled autoShowDataPanel to:', autoShowDataPanel); }); $(document).ready(function() { console.log('Document ready'); if (autoShowDataPanel) { initializeInterface(); } // 监听快捷键 Alt+N 来手动打开或关闭界面 $(document).on('keydown', function(e) { if (e.altKey && e.key === 'g') { console.log('Alt+G pressed'); toggleInterface(); } }); }); function initializeInterface() { console.log('Initializing interface'); if ($('#tiktok-data-ui').length) { console.log('Interface already initialized'); return; } const container = $( `